package com.atguigu.singleton;

/**
 * @author LYJ
 * @Description  通过静态内部类来实现
 * @date 2021 年 09 月 09 日 下午7:50
 */
public class SingleTonTest1 {

    private SingleTonTest1() {

    }

    public static SingleTonTest1 getInstance() {
        return InnerClass.singleTonTest1;
    }

    private static class InnerClass {
        private static final SingleTonTest1 singleTonTest1 = new SingleTonTest1();
    }

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            new Thread(() -> {
                System.out.println(SingleTonTest1.getInstance());
            },"" + i).start();
        }
    }
}

